package job;

import java.io.Serializable;
import java.util.Random;

public final class Job implements Serializable, Runnable {
	
	private static final long serialVersionUID = 2944359400846070614L;
	private static final int MAX_SLEEP = 20;
	private static final int MAX = 1000;
	private int result;
	private String name;
	private Random random;
	
	
	public Job(String name) {
		this.name = name;
		this.random = new Random();
	}

	public int getResult() {
		return this.result;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void run() {
		try {
			Thread.sleep(random.nextInt(MAX_SLEEP)*1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		result = random.nextInt(MAX);
	}

}
